package com.example.luckypan;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;

import com.example.lunckypanlib.view.RotaryView;

public class RotaryActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rotary);
        final RotaryView rotaryView = findViewById(R.id.rotary);
        rotaryView.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                rotaryView.animtorStart();
                return true;
            }
        });
        rotaryView.setRotaryListenner(new RotaryView.RotaryListenner() {
            @Override
            public void rotaryReward(int reward) {
                Toast.makeText(getApplicationContext(), "恭喜你中了" + reward + "张卡片", Toast.LENGTH_LONG).show();
            }
        });
    }

}
